package com.my.demo.controller;

import com.my.demo.pojo.Result;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liangyuanshao
 * @date 2021/12/19 - 0:23
 */
@RestController
public class LogoutController {
  @PostMapping("/logout")
  public Result logout() {
    Result result=new Result();
    result.setSuccess(false);
    Subject subject = SecurityUtils.getSubject();
    subject.logout();//退出用户
    result.setSuccess(true);
    result.setMsg("退出成功");
    return result;
  }

}
